# -*- coding: utf-8 -*-

"""
@author: atao
@Remark: 系统日志管理
"""

from dvadmin.system.models import SysLog
from dvadmin.utils.serializers import CustomModelSerializer
from dvadmin.utils.viewset import CustomModelViewSet


class SysLogSerializer(CustomModelSerializer):
    """
    日志-序列化器
    """

    class Meta:
        model = SysLog
        fields = "__all__"
        read_only_fields = ["id"]


class SysLogCreateUpdateSerializer(CustomModelSerializer):
    """
    操作日志  创建/更新时的列化器
    """

    class Meta:
        model = SysLog
        fields = '__all__'


class SysLogViewSet(CustomModelViewSet):
    """
    系统日志接口
    list:查询
    create:新增
    update:修改
    retrieve:单例
    destroy:删除
    """
    queryset = SysLog.objects.order_by('-create_datetime')
    serializer_class = SysLogSerializer
    # filter_fields = ['creator_id']

    # permission_classes = []

